package org.tio.site.controller;

import org.tio.http.common.HttpRequest;
import org.tio.http.common.HttpResponse;
import org.tio.http.server.annotation.RequestPath;
import org.tio.http.server.util.Resps;
import org.tio.site.service.CaseService;

import com.jfinal.plugin.activerecord.Page;
import com.jfinal.plugin.activerecord.Record;

/**
 * @author tanyaowu
 * 2017年7月22日 上午10:44:13
 */
@RequestPath(value = "/case")
public class CaseController {
	//	private static Logger log = LoggerFactory.getLogger(CaseController.class);

	static final CaseService srv = CaseService.me;

	/**
	 * @param args
	 * @author tanyaowu
	 */
	public static void main(String[] args) {

	}

	/**
	 *
	 * @author tanyaowu
	 */
	public CaseController() {
	}

	@RequestPath(value = "/page")
	public HttpResponse page(Integer pageNumber, Integer pageSize, HttpRequest request) throws Exception {
		Page<Record> page = srv.page(pageNumber, pageSize);
		HttpResponse ret = Resps.json(request, page);
		return ret;
	}
}
